/* FT56.sas 'home/chansen/work/migration' CBH ? Last modified 3/19/01 */

/* Panel from Table 6 without exogenous EU share */
/* Uses distance from Pristina to nearest big city */

options ls=78 compress=yes;

libname mydata 'EXTENSION HERE';

proc sort data=mydata.pristina;
 by country;

data temp2;
 set mydata.rsa8399n;

proc sort;
 by country;

data reg8399;
 merge temp1 temp2;
 by country;

 nowarpr1=nowar*Sardis1/1000;
 nbospr1=nwbosnia*Sardis1/1000;
 nkospr1=nwkosovo*prdis1/1000;

 %macro years; d84 d85 d86 d87 d88 d89 d90 d91 d92 d93 d94 d95 d96 d97 d98 d99 %mend;
 %macro country; be dk de91 de_91 gr es fr ie it lu nl at pt fi se uk no is ch %mend;
 %macro ctrends; trendbe trendk trende91 trend_91 trendgr trendes trendfr trendie
                 trendit trendlu trendnl trendat trendpt trendfi trendse trenduk
                 trendno trendis trendch %mend;
 %macro inst1; nbospr1 nowarpr1 nkospr1 %mend;
 %macro inst2; nbosds12 noward12 nkosds12 p96schen %mend;

/* IV Regressions using 1983-99 period Sample by Sex-Age Groups
   with Log Share of NN from Non-EU Countries */

/* Unweighted OLS Regressions using 1983-99 Sample for All Men with
   and without Country Trends */

proc syslin 2sls data=reg8399;
 where dman=1 & is=0;
 title '1983-99, All men, without country trends';
 endogenous lne_p lnf_lf1;
 instruments %years %country dold %inst1;
 model lne_p = lnf_lf1 %years %country dold;
run;

proc syslin 2sls data=reg8399;
 where dman=1 & is=0;
 title '1983-99, All men, with country trends';
 endogenous lne_p lnf_lf1;
 instruments %years %country dold %ctrends %inst1;
 model lne_p = lnf_lf1 %years %country %ctrends dold;
run;

/* Unweighted OLS Regressions using 1983-99 Sample for Young Men with
   and without Country Trends */

proc syslin 2sls data=reg8399;
 where dman=1 & dold=0 & is=0;
 title '1983-99, Young men, without country trends';
 endogenous lne_p lnf_lf1;
 instruments %years %country %inst1;
 model lne_p = lnf_lf1 %years %country;
run;

proc syslin 2sls data=reg8399;
 where dman=1 & dold=0 & is=0;
 title '1983-99, Young men, with country trends';
 endogenous lne_p lnf_lf1;
 instruments %years %country %ctrends %inst1;
 model lne_p = lnf_lf1 %years %country %ctrends;
run;

/* Unweighted OLS Regressions using 1983-99 Sample for Older Men with
   and without Country Trends */

proc syslin 2sls data=reg8399;
 where dman=1 & dold=1 & is=0;
 title '1983-99, Older men, without country trends';
 endogenous lne_p lnf_lf1;
 instruments %years %country %inst1;
 model lne_p = lnf_lf1 %years %country;
run;

proc syslin 2sls data=reg8399;
 where dman=1 & dold=1 & is=0;
 title '1983-99, Older men, with country trends';
 endogenous lne_p lnf_lf1;
 instruments %years %country %ctrends %inst1;
 model lne_p = lnf_lf1 %years %country %ctrends;
run;

/* Unweighted OLS Regressions using 1983-99 Sample for All Women with
   and without Country Trends */

proc syslin 2sls data=reg8399;
 where dman=0 & is=0;
 title '1983-99, All Women, without country trends';
 endogenous lne_p lnf_lf1;
 instruments %years %country dold %inst1;
 model lne_p = lnf_lf1 %years %country dold;
run;

proc syslin 2sls data=reg8399;
 where dman=0 & is=0;
 title '1983-99, All Women, with country trends';
 endogenous lne_p lnf_lf1;
 instruments %years %country dold %ctrends %inst1;
 model lne_p = lnf_lf1 %years %country %ctrends dold;
run;

/* Unweighted OLS Regressions using 1983-99 Sample for Young Women with
   and without Country Trends */

proc syslin 2sls data=reg8399;
 where dman=0 & dold=0 & is=0;
 title '1983-99, Young Women, without country trends';
 endogenous lne_p lnf_lf1;
 instruments %years %country %inst1;
 model lne_p = lnf_lf1 %years %country;
run;

proc syslin 2sls data=reg8399;
 where dman=0 & dold=0 & is=0;
 title '1983-99, Young Women, with country trends';
 endogenous lne_p lnf_lf1;
 instruments %years %country %ctrends %inst1;
 model lne_p = lnf_lf1 %years %country %ctrends;
run;

/* Unweighted OLS Regressions using 1983-99 Sample for Older Women with
   and without Country Trends */

proc syslin 2sls data=reg8399;
 where dman=0 & dold=1 & is=0;
 title '1983-99, Older Women, without country trends';
 endogenous lne_p lnf_lf1;
 instruments %years %country %inst1;
 model lne_p = lnf_lf1 %years %country;
run;

proc syslin 2sls data=reg8399;
 where dman=0 & dold=1 & is=0;
 title '1983-99, Older Women, with country trends';
 endogenous lne_p lnf_lf1;
 instruments %years %country %ctrends %inst1;
 model lne_p = lnf_lf1 %years %country %ctrends;
run;






**********************************************************************;
**********************************************************************;
**********************************************************************;
/* Panel of Table 6 with exogenous EU share */
/* Uses distance from Pristina to nearest big city */

proc sort data=mydata.pristina out=temp1;
 by country;

data temp2;
 set mydata.rsa8399n;

proc sort;
 by country;

data reg8399;
 merge temp1 temp2;
 by country;

 nowarpr1=nowar*Sardis1/1000;
 nbospr1=nwbosnia*Sardis1/1000;
 nkospr1=nwkosovo*prdis1/1000;

 %macro years; d84 d85 d86 d87 d88 d89 d90 d91 d92 d93 d94 d95 d96 d97 d98 d99 %mend;
 %macro country; be dk de91 de_91 gr es fr ie it lu nl at pt fi se uk no is ch %mend;
 %macro ctrends; trendbe trendk trende91 trend_91 trendgr trendes trendfr trendie
                 trendit trendlu trendnl trendat trendpt trendfi trendse trenduk
                 trendno trendis trendch %mend;
 %macro inst1; nbospr1 nowarpr1 nkospr1 %mend;
 %macro inst2; nbosds12 noward12 nkosds12 p96schen %mend;

/* IV Regressions using 1983-99 period Sample by Sex-Age Groups
   with Log Share of NN from Non-EU Countries */

/* Unweighted OLS Regressions using 1983-99 Sample for All Men with
   and without Country Trends */

proc syslin 2sls data=reg8399;
 where dman=1 & is=0;
 title '1983-99, All men, without country trends';
 endogenous lne_p lnf_lf1;
 instruments %years %country lneu_lf1 dold %inst1;
 model lne_p = lnf_lf1 %years %country lneu_lf1 dold;
run;

proc syslin 2sls data=reg8399;
 where dman=1 & is=0;
 title '1983-99, All men, with country trends';
 endogenous lne_p lnf_lf1;
 instruments %years %country lneu_lf1 dold %ctrends %inst1;
 model lne_p = lnf_lf1 %years %country lneu_lf1 %ctrends dold;
run;

/* Unweighted OLS Regressions using 1983-99 Sample for Young Men with
   and without Country Trends */

proc syslin 2sls data=reg8399;
 where dman=1 & dold=0 & is=0;
 title '1983-99, Young men, without country trends';
 endogenous lne_p lnf_lf1;
 instruments %years %country lneu_lf1 %inst1;
 model lne_p = lnf_lf1 %years %country lneu_lf1;
run;

proc syslin 2sls data=reg8399;
 where dman=1 & dold=0 & is=0;
 title '1983-99, Young men, with country trends';
 endogenous lne_p lnf_lf1;
 instruments %years %country lneu_lf1 %ctrends %inst1;
 model lne_p = lnf_lf1 %years %country lneu_lf1 %ctrends;
run;

/* Unweighted OLS Regressions using 1983-99 Sample for Older Men with
   and without Country Trends */

proc syslin 2sls data=reg8399;
 where dman=1 & dold=1 & is=0;
 title '1983-99, Older men, without country trends';
 endogenous lne_p lnf_lf1;
 instruments %years %country lneu_lf1 %inst1;
 model lne_p = lnf_lf1 %years %country lneu_lf1;
run;

proc syslin 2sls data=reg8399;
 where dman=1 & dold=1 & is=0;
 title '1983-99, Older men, with country trends';
 endogenous lne_p lnf_lf1;
 instruments %years %country lneu_lf1 %ctrends %inst1;
 model lne_p = lnf_lf1 %years %country lneu_lf1 %ctrends;
run;

/* Unweighted OLS Regressions using 1983-99 Sample for All Women with
   and without Country Trends */

proc syslin 2sls data=reg8399;
 where dman=0 & is=0;
 title '1983-99, All Women, without country trends';
 endogenous lne_p lnf_lf1;
 instruments %years %country lneu_lf1 dold %inst1;
 model lne_p = lnf_lf1 %years %country lneu_lf1 dold;
run;

proc syslin 2sls data=reg8399;
 where dman=0 & is=0;
 title '1983-99, All Women, with country trends';
 endogenous lne_p lnf_lf1;
 instruments %years %country lneu_lf1 dold %ctrends %inst1;
 model lne_p = lnf_lf1 %years %country lneu_lf1 %ctrends dold;
run;

/* Unweighted OLS Regressions using 1983-99 Sample for Young Women with
   and without Country Trends */

proc syslin 2sls data=reg8399;
 where dman=0 & dold=0 & is=0;
 title '1983-99, Young Women, without country trends';
 endogenous lne_p lnf_lf1;
 instruments %years %country lneu_lf1 %inst1;
 model lne_p = lnf_lf1 %years %country lneu_lf1;
run;

proc syslin 2sls data=reg8399;
 where dman=0 & dold=0 & is=0;
 title '1983-99, Young Women, with country trends';
 endogenous lne_p lnf_lf1;
 instruments %years %country lneu_lf1 %ctrends %inst1;
 model lne_p = lnf_lf1 %years %country lneu_lf1 %ctrends;
run;

/* Unweighted OLS Regressions using 1983-99 Sample for Older Women with
   and without Country Trends */

proc syslin 2sls data=reg8399;
 where dman=0 & dold=1 & is=0;
 title '1983-99, Older Women, without country trends';
 endogenous lne_p lnf_lf1;
 instruments %years %country lneu_lf1 %inst1;
 model lne_p = lnf_lf1 %years %country lneu_lf1;
run;

proc syslin 2sls data=reg8399;
 where dman=0 & dold=1 & is=0;
 title '1983-99, Older Women, with country trends';
 endogenous lne_p lnf_lf1;
 instruments %years %country lneu_lf1 %ctrends %inst1;
 model lne_p = lnf_lf1 %years %country lneu_lf1 %ctrends;
run;

